package sjtu;

import java.util.Scanner;

public class Sjtu1022 {
	public static void main(String[] args) {
		new Sjtu1022().go();
	}
	
//	public int fi(int n){
//		if(n == 1 || n == 2){
//			return 1;
//		}else{
//			return this.fi(n - 1) + this.fi(n - 2);
//		}
//	}
	
	public int fi(int n){

		int num1 = 1,num2 = 1,temp;
		
		if(n == 1 || n == 2){
			return 1;
		}else{
			for(int i = 1;i <= n - 2;i ++){
				temp = num2;
				num2 = (num1 + num2) % 2010;
				num1 = temp;
			}
			return num2;
		}
	}
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		long n;
		while(scan.hasNext()){
			n = scan.nextLong();
			if(n <= 2040){
				System.out.println(this.fi((int)n));
			}else{
				if(n % 2040 == 0){
					System.out.println(this.fi(2040));
				}else{
					System.out.println(this.fi((int)(n % 2040)));
				}
			}
		}
	}	
}